﻿#pragma once


#include <QDialog>
#include <QPushButton>
#include "QListView"
#include "QStringListModel"
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QVBoxLayout"
#include <QDesktopWidget>
#include <QLibrary>
#include <QApplication>
#include <QLabel>
#include <QComboBox>
#include "QListView"
#include "QStringListModel"
#include "QLineEdit"
#include "QSpinBox"
#include "QRadioButton"
#include <QSettings>

#include "commonfunction.h"

#include "halcon_opencv.h"

using namespace std;

#include "qt_graphics_view_image.h"
//#include "qt_graphics_shape_rectangle.h"


#include <QSettings>

class FunctionSegmentRect:public QDialog
{
    Q_OBJECT
public:
    QSettings* m_qsettings;

    Mat m_image ,m_image_show,mat_model;
    QString m_path_para = "";
    QString m_section   = "";

    MyQGraphicsView* m_view ;

    QLabel * m_qlabel_inner_radius;
    QSpinBox * m_qspinbox_inner_radius;
	int m_inner_radius = 100;


    QLabel * m_qlabel_outer_radius;
    QSpinBox * m_qspinbox_outer_radius;
	int m_outer_radius = 1000;

	QPushButton* m_pushbutton_open_model_image;
    QPushButton* m_pushbutton_create_model;

    QPushButton* m_pushbutton_show_orign_image;
    QPushButton* m_pushbutton_detection;
    QPushButton* m_pushbutton_save_parameter;
    QPushButton* m_pushbutton_return;
    QPushButton* m_pushbutton_dir_crop;

    QLabel* m_qlabel_message;

	HObject image_crop;

	HObject image_in;
    int row1, column1, row2, column2;

public:
    explicit FunctionSegmentRect(QDialog *parent = nullptr, QSettings* qsettings = nullptr,QString section = "");
    ~FunctionSegmentRect() ;

    void         create_model();
    virtual void detectionImage();
    virtual bool detection(HObject image_in,QString& message);
    virtual void draw( Mat image_in,Mat& image_out);
    virtual void loadParameter(QString path_in,QString section);
    virtual void saveParameter();
    virtual bool showDialog();
//    void         testImage();
    //void value_changed_m_qspinbox_inner_radius(int value);
signals:
    void saveImage();
};
#pragma execution_character_set("utf-8")
